@select-prefix-cls: ~"@{css-prefix}select";
@select-item-prefix-cls: ~"@{css-prefix}select-item";
@select-group-prefix-cls: ~"@{css-prefix}select-group";
// TODO 应定义在form.less
@form-prefix-cls: ~"@{css-prefix}form";
@form-item-prefix-cls: ~"@{form-prefix-cls}-item";

.@{select-prefix-cls} {
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
    vertical-align: middle;
    color: @text-color;
    font-size: @font-size-base;
    //position: relative;
    line-height: normal;

    &-selection {
        display: block;
        box-sizing: border-box;
        outline: none;
        user-select: none;
        cursor: pointer;
        position: relative;

        background-color: @background-color-selection;
        border-radius: @btn-border-radius;
        border: 1px solid @border-color-base;
        transition: all @transition-time @ease-in-out;

        &:hover, &-focused {
            .hover();
            .@{select-prefix-cls}-arrow {
                display: inline-block;
            }
        }
    }

    &-arrow {
        .inner-arrow();
    }

    &-visible{
        .@{select-prefix-cls}-selection{
            .active();
        }

        .@{select-prefix-cls}-arrow {
            transform: translateY(-50%) rotate(180deg);
            display: inline-block;
        }
    }

    &-disabled {
        .@{select-prefix-cls}-selection {
            .disabled();

            .@{select-prefix-cls}-arrow {
                color: @slider-disabled-color;
            }

            &:hover {
                border-color: @border-color-base;
                box-shadow: none;

                .@{select-prefix-cls}-arrow {
                    display: inline-block;
                }
            }
        }
    }

    &-single &-selection{
        height: @input-height-base;
        position: relative;

        .@{select-prefix-cls}-placeholder{
            color: @input-placeholder-color;
        }

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            display: block;
            height: @input-height-base - 2px;
            line-height: @input-height-base - 2px;
            font-size: @font-size-base;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding-left: 8px;
            padding-right: 24px;
        }
    }

    &-multiple &-selection{
        padding: 0 24px 0 4px;
        //min-height: @input-height-base;

        .@{select-prefix-cls}-placeholder{
            display: block;
            height: @input-height-base - 2px;
            line-height: @input-height-base - 2px;
            color: @input-placeholder-color;
            font-size: @font-size-base;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding-left: 4px;
            padding-right: 22px;
        }
        .@{select-prefix-cls}-head-sum {
          display: flex;
          justify-content: space-between;
          align-items: center;
        }
        .e-tag-no-border{
          border: none;
          margin: 3px 4px 3px 0;
          color: @color-complementary-3;
          background-color: @color-bg-select-tag;
        }
    }
    &-default&-multiple &-selection{
        min-height: @input-height-base;
    }

    &-large&-single &-selection{
        height: @input-height-large;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: @input-height-large - 2px;
            line-height: @input-height-large - 2px;
            font-size: @font-size-large;
        }
    }

    &-large&-multiple &-selection{
        min-height: @input-height-large;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            min-height: @input-height-large - 2px;
            line-height: @input-height-large - 2px;
            font-size: @font-size-large;
        }
    }

    &-small&-single &-selection{
        height: @input-height-small;
        border-radius: @btn-border-radius-small;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: @input-height-small - 2px;
            line-height: @input-height-small - 2px;
        }
    }

    &-small&-multiple &-selection{
        min-height: @input-height-small;
        border-radius: @btn-border-radius-small;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: auto;
            min-height: @input-height-small - 2px;
            line-height: @input-height-small - 2px;
        }
    }

    // 新增的middle尺寸
    &-middle&-single &-selection{
        height: @input-height-middle;
        border-radius: @btn-border-radius-middle;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: @input-height-middle - 2px;
            line-height: @input-height-middle - 2px;
        }
    }

    &-middle&-multiple &-selection{
        min-height: @input-height-middle;
        border-radius: @btn-border-radius-middle;

        .@{select-prefix-cls}-placeholder, .@{select-prefix-cls}-selected-value{
            height: auto;
            min-height: @input-height-middle - 2px;
            line-height: @input-height-middle - 2px;
        }
    }

    &-dropdown-list {
        //display: inline-block;
        min-width: 100%;
        list-style: none;
        margin-bottom: 5px;
        .@{select-group-prefix-cls}-wrap {
          .@{select-group-prefix-cls}-line {
            padding-bottom: 7px;
            margin-top: 9px;
          }
          &:first-child {
            .@{select-group-prefix-cls}-line {
              padding-bottom: 7px;
              margin-top: 0px;
              div {
                display: none;
              }
            }
          }
          .@{select-group-prefix-cls} {
            // padding-left: 20px;
            .@{select-item-prefix-cls} {
              padding-left: 30px;
            }
          }
        }
    }

    &-dropdown-list-footer {
      border-top: 1px solid #E9EBEF;
      height: 36px;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    &-dropdown-list-footer-create-item-content {
      padding-left: 10px;
      padding-right: 10px;
      width: 100%;
      display: flex;
    }

    &-dropdown-list-footer-create-item-title {
      // font-size: 12px;
      // color: @primary-color;
      // cursor: pointer;
      // button {    
        display: flex;
        align-items: center;
        margin-left: -10px;
        i {
          transform: scale(0.8);
          margin-right: 3px;
        }
        span {
        //   margin-left: 0px;
        }
      // }
    }

    &-dropdown-list-footer-create-item-input {
      // width: 110px;
      flex: 1;
      margin-right: 17px;
    }

    & &-dropdown{
        width: auto;
        text-align: left;
        padding-top: 5px;
    }
    &-dropdown-has-footer {
      overflow-y: hidden;
    }
    &-dropdown-has-footer &-dropdown-list{
      overflow: auto;
      max-height: 150px;
    }

    // input
    &-input{
        display: inline-block;
        height: @input-height-base;
        line-height: @input-height-base;
        padding: 0 24px 0 8px;
        font-size: @font-size-base;
        outline: none;
        border: none;
        box-sizing: border-box;
        color: @input-color;
        background-color: transparent;
        position: relative;
        cursor: pointer;
        .placeholder();

        &[disabled]{
            cursor: @cursor-disabled;
            color: @color-brand-disabled2;
            -webkit-text-fill-color: @color-brand-disabled2;  // #5249
        }
    }

    &-single &-input{
        width: 100%;
    }

    &-large &-input, &-large&-multiple &-input{
        font-size: @font-size-large;
        height: @input-height-large - 8px;
        line-height: @input-height-large - 8px;
        top: 3px;
    }

    &-small &-input, &-small&-multiple &-input{
        height: @input-height-small - 6px;
        line-height: @input-height-small - 6px;
        top: 2px;
    }

    // 新增middle样式
    &-middle &-input, &-middle&-multiple &-input{
      height: @input-height-middle - 6px;
      line-height: @input-height-middle - 6px;
      top: 2px;
    }

    &-multiple &-input{
        height: @input-height-base - 6px;
        line-height: @input-height-base - 6px;
        padding: 0 0 0 4px;
        top: 2px;
    }

    &-not-found{
        text-align: center;
        color: @btn-disable-color;
        li:not([class^=haloe-]){
            margin-bottom: 0;
        }
    }
    &-loading{
        text-align: center;
        color: @btn-disable-color;
    }

    &-multiple .@{css-prefix}tag{
        height: 24px;
        line-height: 22px;
        margin: 3px 4px 3px 0;
        max-width: 99%;
        position: relative;
        span:not(.haloe-select-max-tag){
            display: block;
            margin-right: 14px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        i{
            display: block;
            position: absolute;
            right: 4px;
            top: 4px;
        }
    }
    &-multiple-tag-hidden{
        margin-right: 0 !important;
    }

    &-large&-multiple .@{css-prefix}tag{
        height: 32px;
        line-height: 30px;
        font-size: @font-size-large;
        i{
            top: 9px;
        }
    }

    &-small&-multiple .@{css-prefix}tag{
        height: 17px;
        line-height: 15px;
        font-size: @font-size-small;
        padding: 0 6px;
        margin: 3px 4px 2px 0;
        span{
            margin-right: 14px;
        }
        i{
            top: 1px;
            right: 2px;
        }
    }

    // TODO 新增middle样式，根据实际效果修改
    &-middle&-multiple .@{css-prefix}tag{
      height: 32px;
      line-height: 30px;
      font-size: @font-size-large;
      i{
          top: 9px;
      }
    }

    &-dropdown-list {
        //display: inline-block;
        min-width: 100%;
        list-style: none;
    }

    &-dropdown-list-footer-create-item-content {
        padding-left: 10px;
        padding-right: 10px;
        width: 100%;
        display: flex;
      }
  
      &-dropdown-list-footer-create-item-title {
        // font-size: 12px;
        // color: @primary-color;
        // cursor: pointer;
        // button {    
          display: flex;
          align-items: center;
          margin-left: -10px;
          i {
            transform: scale(0.8);
            margin-right: 3px;
          }
          span {
          //   margin-left: 0px;
          }
        // }
      }
  
      &-dropdown-list-footer-create-item-input {
        // width: 110px;
        flex: 1;
        margin-right: 17px;
      }

    & &-dropdown{
        width: inherit;
    }

    &-prefix{
        display: inline-block;
        vertical-align: middle;
        i{
            vertical-align: top;
        }
    }
    &-head-with-prefix{
        display: inline-block !important;
        vertical-align: middle;
    }
    &-single &-prefix{
        padding-left: 4px;
    }
    &-single &-head-with-prefix, &-multiple &-head-with-prefix{
        padding-left: 0 !important;
    }

    &-head-flex{
        display: flex;
        align-items: center;
    }

    &-multiple &-head-flex &-prefix{
        margin-right: 4px;
    }
}

.select-item(@select-prefix-cls, @select-item-prefix-cls);

.@{select-prefix-cls}-multiple .@{select-item-prefix-cls} {
    position: relative;
    &-selected{
        color: @selected-color;
        // background: #fff;
        background: @color-complementary-10;
    }
    &-focus,&-selected:hover{
        background: @background-color-select-hover;
    }

    &-selected&-focus {
        color: shade(@selected-color, 10%);
        background: #fff;
    }

    &-selected:after{
        .haloe-icon();
        float: right;
        font-size: @font-size-base;
        content: "\e698";
        color: @selected-color;
        position: absolute;
        top: 8px;
        right: 8px;
    }
    &-checkbox-label{
        margin-left: 5px;
    }
    &-selected.haloe-select-item-disabled{
        color: @btn-disable-color;
        &:after{
            color: @btn-disable-color;
        }
        &:hover{
            // background-color: #fff;
            background-color: @color-complementary-10;
        }
    }
}

.@{select-item-prefix-cls}-delete-icon{
    float: right!important;
    margin-right: 10px;
    &:hover{
      color: @primary-color;
    }
    margin-top: 2.5px;
}

.@{select-group-prefix-cls} {
    list-style: none;
    margin: 0;
    padding: 0;

    &-title {
        padding-left: 8px;
        font-size: 14px;
        color: @legend-color;
        height: 30px;
        line-height: 30px;
    }
}

.@{form-item-prefix-cls}-error{ 
    .@{select-prefix-cls}{
        &-selection{
            border: 1px solid @error-color;
        }
        &-arrow{
            color: @error-color;
        }
        &-visible .@{select-prefix-cls}-selection{
            .active-error;
        }
    }
}

::-webkit-scrollbar {
  width: 6px;
  cursor: pointer;
}
::-webkit-scrollbar-track {
  background-color: @color-scrollbar-track !important;
}
::-webkit-scrollbar-thumb {
  background-color: @color-scrollbar !important;
  border-radius: 6px;
}